﻿using System;
using System.IO;
using System.Windows.Media.Media3D;

using SBPweb.MediaCenter.Tools.WPF.Resources;

using SBPweb.MediaCenter.Common.Extenders;

namespace SBPweb.MediaCenter.Tools.WPF.Controls
{

    public class Model3DSVisual3D : ModelVisual3D
    {

        #region Private fields

        //protected TagDictionary tag = new TagDictionary();

        #endregion

        #region Constructor logic

        public Model3DSVisual3D(string fileName)
        {
            Initialize(Resource3DSReader.ReadModel3DGroupFromFile(fileName));
        }

        public Model3DSVisual3D(Stream fileStream)
        {
            Initialize(Resource3DSReader.ReadModel3DGroupFromFile(fileStream));
        }

        #endregion

        #region Methods

        private void Initialize(Model3DGroup mgp)
        {
            this.Children.Clear();
            foreach (Model3D m3d in mgp.Children)
            {
                ModelVisual3D mv3d = new ModelVisual3D();
                mv3d.Content = m3d;
                this.Children.Add(mv3d);
            }
        }

        #endregion

    }

}